package com.hex.ds.hdtp.core.app.script.common.service.impl;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;

@Component
public class ScriptConvertFileFilter implements FileFilter {

    @Value("${file.uploadType}")
    private String uploadType;

    @Override
    public boolean accept(File pathname) {
        String suffix = pathname.getName().substring(pathname.getName().lastIndexOf(".") + 1);
        if (Arrays.asList(uploadType.split(",")).contains(suffix)) {
           return true;
        }
        return false;
    }
}
